#if UNITY_EDITOR
using System.Collections.Generic;
using System.Text;
using UnityEditor;
#endif
using UnityEngine;

public enum E_ItemType
{
    material,
    equipment,
    flask
}


[CreateAssetMenu()]
public class ItemData : ScriptableObject
{
    public string itemId;
    public string itemName;
    [TextArea]
    public string description;
    public Sprite icon;
    public E_ItemType type;
    public List<ItemEffect> effects;
    public int price; 

    [Range(0, 100)]
    public int dropChance;

    protected StringBuilder sb = new StringBuilder();


    private void OnValidate()
    {
#if UNITY_EDITOR
        string path = AssetDatabase.GetAssetPath(this);
        itemId = AssetDatabase.AssetPathToGUID(path);
#endif
    }

    public void ExecuteEffects(Transform _target)
    {
        foreach (var effect in effects) 
        {
            effect.ExecuteEffect(_target);
        }
    }


}
